import Vue from 'vue'
import VueRouter from 'vue-router'
import Home from '../views/Home.vue'

Vue.use(VueRouter)

const routes = [
  {
    path: '/',
    // 重定向到登录页面 
    redirect: '/login',
    component: Home
  },
  {
    path: '/login',
    name: 'Login',
    component: () => import('@/pages/login.vue')
  },
  {
    path: '/manager',
    name: 'Manager',
    redirect:'/manager/home',
    component: () => import('@/pages/manager.vue'),
    children: [
      {
        path: 'home',
        name: 'Home',
        component: () => import('@/pages/home.vue')
      },
      {
        path: 'order',
        name: 'Order',
        component: () => import('@/pages/order.vue')
      },
      {
        path: 'detail',
        name: 'Detail',
        component: () => import('@/pages/Detail.vue')
      },
      {
        path: 'help',
        name: 'Help',
        component: () => import('@/pages/help.vue')
      },
      {
        path: 'user',
        name: 'User',
        component: () => import('@/pages/user.vue')
      },
      {
        path:'productList',
        name:'productList',
        component:()=>import('@/pages/productList.vue')
      },
      {
        path:'pay',
        name:'pay',
        component:()=>import('@/pages/pay.vue')
      },
      {
        path:'address',
        name:'address',
        component:()=>import('@/pages/address.vue')
      },
    ]
  },
]

const router = new VueRouter({
  mode: 'history',
  base: process.env.BASE_URL,
  routes
})

export default router
